﻿using System.Collections;

namespace SDL
{
    public static class IDictionaryExtension
    {
        public static IDictionary GetDifferences(this IDictionary dict, IDictionary dict2)
        {
            IDictionary result = new Hashtable();
            IEnumerator iter = dict.GetEnumerator();

            if (dict2 == null) dict2 = new Hashtable();

            while (iter.MoveNext())
            {
                var dataObject = ((DictionaryEntry)iter.Current).Key;
                if (dict2.Contains(dataObject))
                {
                    var value = dict2[dataObject];
                    if (value.Equals(dict[dataObject])) continue;
                }
                result.Add(dataObject, dict[dataObject]);
            }
            return (result);
        }
    }
}
